@import './variables.module.scss';

#app {

  .main-container {
    min-height: 100%;
    transition: margin-left .28s;
    margin-left: $sideBarWidth;
    position: relative;
  }

  .sidebar-container {
    transition: width 0.28s;
    width: $sideBarWidth !important;
    background-color: #0C1F39;
    position: absolute;
    font-size: 0px;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1001;
    overflow: hidden;
    box-shadow: 2px 0px 6px rgba(0, 21, 41, 0.12);

    // reset element-ui css
    .horizontal-collapse-transition {
      transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
    }

    .scrollbar-wrapper {
      overflow-x: hidden !important;
    }

    .el-scrollbar__bar.is-vertical {
      right: 0px;
    }

    .el-scrollbar {
      height: 100%;
    }

    &.has-logo {
      .el-scrollbar {
        // margin-top: 20px;
        height: calc(100% - 50px);
      }
    }

    .is-horizontal {
      display: none;
    }

    // a {
    //   display: inline-block;
    //   width: 100%;
    //   overflow: hidden;
    // }

    

    .el-menu {
      border: none;
      height: 100%;
      width: 100% !important;

      .iconfont {
        margin-right: 12px;
        font-size: 16px;
        color: $menuText !important;
        [data-theme=dark] &{
          color: $menuText_dark !important;
        }
      }
      
    }

    .menu-wrapper {
      margin: 0 0;
    }

    // menu hover
    .el-submenu.is-opened {
      .el-submenu__title {
        color: $submenuActiveTitleText !important;
        background-color: $submenuActiveTitleBg !important;

        .iconfont,
        i {
          color: $subMenuActiveText !important;
        }
      }
    }

    .submenu-title-noDropdown,
    .el-submenu__title {
      &:hover {
        color: $menuHoverText !important;
        background-color: $menuHover !important;
        [data-theme=dark] &{
          background: $subMenuActiveBg_dark !important;
          color: $menuText_dark !important;
        }
        .iconfont,
        i {
          color: $menuHoverText !important;
          [data-theme=dark] &{
            color: $menuText_dark !important;
          }
        }
      }
    }

    & .nest-menu .el-submenu>.el-submenu__title,
    & .el-submenu .el-menu-item {
      min-width: $sideBarWidth !important;
      background: $submenuItemBg !important;

      &:hover {
        color: $subMenuHoverText !important;
        background-color: $subMenuHover !important;

        .iconfont {
          color: $subMenuHoverText !important;
        }
      }
    }

    //菜单选择后的样式图片
    .router-link-active {
      background: $menuActiveBg !important;
      [data-theme=dark] &{
        background: $menuActiveBg_dark !important;
      }
      .iconfont {
        color: $menuActiveText !important;
        [data-theme=dark] &{
          color: $menuActiveText_dark !important;
        }
        
      }

      //二级菜单
      >li {
        background: $subMenuActiveBg !important;
        color: $subMenuActiveText !important;
        [data-theme=dark] &{
          background: $subMenuActiveBg_dark !important;
          color: $subMenuActiveText_dark !important;
        }
      }
    }

    
  }

  .hideSidebar {
    .sidebar-container {
      width: 60px !important;

      .is-active {
        background: none !important
      }
    }

    .main-container {
      margin-left: 60px;
    }

    .submenu-title-noDropdown {
      padding: 0 !important;
      position: relative;

      .el-tooltip {
        padding: 0 !important;

        .iconfont {
          margin-left: 20px;
        }
      }
    }

    .el-submenu {
      overflow: hidden;

      &>.el-submenu__title {
        padding: 0 !important;

        .iconfont {
          margin-left: 20px;
        }

        .el-submenu__icon-arrow {
          display: none;
        }
      }
    }

    .el-menu--collapse {
      .el-submenu {
        &>.el-submenu__title {
          &>span {
            height: 0;
            width: 0;
            overflow: hidden;
            visibility: hidden;
            display: inline-block;
          }
        }

      }
    }
  }

  .el-menu--collapse .el-menu .el-submenu {
    min-width: $sideBarWidth !important;
  }


  .withoutAnimation {

    .main-container,
    .sidebar-container {
      transition: none;
    }
  }
}

// when menu collapsed
.el-menu--vertical {
  &>.el-menu {
    .iconfont {
      margin-right: 16px;
    }
  }

  .nest-menu .el-submenu>.el-submenu__title,
  .el-menu-item {
    &:hover {
      // you can use $subMenuHover
      color: $subMenuHoverText !important;
      background-color: $subMenuHover !important;

      .iconfont {
        color: $subMenuHoverText !important;
      }
    }
  }

  // the scroll bar appears when the subMenu is too long
  >.el-menu--popup {
    max-height: 100vh;
    overflow-y: auto;

    &::-webkit-scrollbar-track-piece {
      background: #d3dce6;
    }

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background: #99a9bf;
      border-radius: 20px;
    }
  }
}


.router-link-active .is-active.el-menu-item:before {
  content: "";
  position: absolute;
  bottom: 0px;
  top: 0px;
  right: 0px;
  width: 2px;
  background-color: $submenuActiveBorder;;
}

.hideSidebar .router-link-active .is-active.el-menu-item:before {
  display: none;
}


.el-menu-item, .el-submenu__title{
  height: 50px;
  line-height: 50px;
}
.el-submenu .el-menu-item{
  height: 40px;
  line-height: 40px;
  padding-left: 49px !important;
}


.el-menu--horizontal{
  >.el-menu-item{
    height: 50px;
    line-height: 50px;
    &.is-active{
      color: #fff !important;
    }
  }
  >.el-submenu{
    .el-submenu__title{
      height: 50px;
      line-height: 50px;
    }
  }
}

.el-menu--collapse>.menu-wrapper>span, .el-menu--collapse>.menu-wrapper>.el-sub-menu>.el-sub-menu__title>span {
  height: 0;
  width: 0;
  overflow: hidden;
  visibility: hidden;
  display: inline-block;
}

.el-menu--collapse>.menu-wrapper>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow {
  display: none;
}